import React from 'react';
import {Route,Switch} from 'react-router-dom';

const fmRoutes = (routes) => {
    return (
        <React.Fragment>
            <Switch>
           {
            routes.map((route) => {
               return (
                   <Route {...route} render={()=>{return (
                           <React.Fragment>
                               {
                                   <route.components children={route.routes ?(fmRoutes(route.routes)) : null}   />
                               }
                           </React.Fragment>
                       )}}>
                       {
                          // route.routes && (fmRoutes(route.routes))
                       }
                   </Route>
               )
            })}
           </Switch>
        </React.Fragment>
    )
}
export { fmRoutes };
